======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
by James Davis, Beagle Buddy 227; Copyright 2016, All rights reserved.
======================================================================

The purpose of this article is to show how to connect an Apple-II to
an IBM-PC (DB-25) Parallel/Printer-Port using the Apple-II 16-Pin
Game-Port connector; and, eventually, to create Apple-II software to
drive it.  Having such an interface allows the Apple-II to communicate
directly with an IBM-PC.

This home-made interface connects an Apple-II to an IBM-PC as if both
are intelligent (3-bit or 4-bit) Parallel Printers.  It is NOT an
Apple-II Parallel/Printer-Port identical to an IBM-PC Parallel/Print-
er-Port.  To build, it requires only half of a Parallel Printer cable,
some electronic buffering and/or line driver circuitry (in a small
box), and half of a 16-Pin DIP jumper-cable.









======================================================================
IBM-PC Parallel Printer Port Pinout
======================================================================

The IBM-PC Parallel Printer Port is a modified Centronics Parallel
Interface.  The connection to the PC is through a DB-25 (25-pin)
connector.  IBM-PC's support up to three parallel ports (some BIOS
support four).  Each port provides 12 TTL outputs and 5 TTL inputs.

These ports have an 8-bit Data-Bus [with eight Positive-Data lines and
eight Negative-Data (Signal-Ground) lines], four Output-Control lines,
and five Input-Control (Device-Status) lines.

Data-Bus directionality depends on the Operation Mode set for the
port.  In Compatibility Mode, the Data-Bus lines are Outputs.  In the
Extended PS/2 Bidirectional Mode, the Enhanced Parallel Port (EPP)
Mode, and the Extended Capability Port (ECP) Mode, the Data-Bus lines
are Inputs and Outputs (Bidirectional).








======================================================================
                               Page  1
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

                       DB-25 CONNECTOR

         ______       +-------------.
        -Strobe <---> | 01 ~         \         ____________
                      |          ~ 14 | <---> -Auto Feed XT
        +D0 <-(LSB)-> | 02            |
                      |            15 | <---< -Error/Fault
        +D1 <-------> | 03            |
                      |            16 | <---> -Reset/Initialize
        +D2 <-------> | 04            |        ____________
                      |          ~ 17 | <---> -Select-Input
        +D3 <-------> | 05            |
                      |            18 | <-"-> -DB0 (Twisted-Pair Gnd)
        +D4 <-------> | 06            |   |
                      |            19 | <-"-> -DB1 (Twisted-Pair Gnd)
        +D5 <-------> | 07            |   |
                      |            20 | <-"-> -DB2 (Twisted-Pair Gnd)
        +D6 <-------> | 08            |   |
                      |            21 | <-"-> -DB3 (Twisted-Pair Gnd)
        +D7 <-(MSB)-> | 09            |   |
                      |            22 | <-"-> -DB4 (Twisted-Pair Gnd)
   -Acknowledge >---> | 10            |   |
           ____       |            23 | <-"-> -DB5 (Twisted-Pair Gnd)
          +Busy >---> | 11 ~          |   |
                      |            24 | <-"-> -DB6 (Twisted-Pair Gnd)
   +Paper-Error >---> | 12            |   |
                      |            25 | <-"-> -DB7 (Twisted-Pair Gnd)
        +Select >---> | 13           /
                      +-------------'   <--->  Casing [Shield-Ground]

 Signal-Ground for +Signals.  (In cables, all signals should have
twisted-pair wiring; each with one wire connected to TTL High or Low.)

                           Legend:

                      +---------------+
                >---> | Input  Signal | <---<
                      | (To Computer) |
                      +---------------+
                <---< | Output Signal | >--->
                      |(From Computer)|
                      +---------------+
                <---> |Input or Output| <--->
                      | (I/O) Signals |
                      |  (To & From   |
                      |   Computer)   |
                      +---------------+

======================================================================
                               Page  2
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

----------------------------------------------------------------------
Pinout Chart
----------------------------------------------------------------------
  Pin No.   Signal Name         Direction   Register-Bit   Inverted
  -------   -----------------   ---------   ------------   --------
  01    ~   -Strobe               In/Out     Control-0     Yes ~
  02        +Data0               In?/Out        Data-0     No
  03        +Data1               In?/Out        Data-1     No
  04        +Data2               In?/Out        Data-2     No
  05        +Data3               In?/Out        Data-3     No
  06        +Data4               In?/Out        Data-4     No
  07        +Data5               In?/Out        Data-5     No
  08        +Data6               In?/Out        Data-6     No
  09        +Data7               In?/Out        Data-7     No
  10        -Acknowledge          In/---      Status-6     No
  11    ~   +Busy                 In/---      Status-7     Yes ~
  12        +Paper-Error          In/---      Status-5     No
  13        +Select               In/---      Status-4     No
  14    ~   -Auto Feed XT         In/Out     Control-1     Yes ~
  15        -Error/Fault          In/---      Status-3     No
  16        -Reset/Initialize     In/Out     Control-2     No
  17    ~   -Select-Input         In/Out     Control-3     Yes ~
  18-25     -Signal-Ground        (N/A)          (N/A)     (N/A)
  Casing     Shield-Ground        (N/A)          (N/A)     (N/A)
----------------------------------------------------------------------

~ Pins 01, 11, 14, and 17 are Negative TTL; the rest are Positive TTL:

Negative TTL (inverted logic) lines are true when pulled low (0 is ON)
and false when pulled high (1 is OFF).

Positive TTL (normal logic) lines are true when pulled high (1 is ON)
and false when pulled low (0 is OFF).


----------------------------------------------------------------------
Function of Output-Control lines
----------------------------------------------------------------------

Control-0 (Pin 01) [Bidirectional]:
 ______
-Strobe clocks the transmission of data: when the data is ready to
transmit, the sender pulls this line low.

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]

----------------------------------------------------------------------

======================================================================
                               Page  3
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

Control-1 (Pin 14) [Bidirectional]:
 ____________
-Auto Feed XT, when held low, enables a printer to automatically feed
paper one line at the end of print lines, and to pagenate at the end
of print pages.

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]

----------------------------------------------------------------------

Control-2 (Pin 16) [Bidirectional]:

-Reset/Initialize, when pulled high, resets and initializes a device;
Resets a printer (clears the print buffer) and initializes the printer
for printing (aligns the print head at the top of the paper and at the
start of the print page).

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]

----------------------------------------------------------------------

Control-3 (Pin 17) [Bidirectional]:
 ____________
-Select-Input; when pulled low, signals a device to get online/turn-
on/wake-up; when pulled high, signals a device to get offline/turn-
off/sleep.

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]


----------------------------------------------------------------------
Function of Input-Control (Device-Status) lines
----------------------------------------------------------------------

Status-3 (Pin 15) [Unidirectional]:

-Error/Fault, when pulled high, signals a Device-Fault.  The device is
offline (turned-off/asleep/broken) and unable to receive data.

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]

----------------------------------------------------------------------

Status-4 (Pin 13) [Unidirectional]:

+Select, when pulled high, signals that a device is online and ready
to receive data.

======================================================================
                               Page  4
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

[Twisted-Pair's -signal-wire connects to TTL Low (Gnd).]

----------------------------------------------------------------------

Status-5 (Pin 12) [Unidirectional]:

-Paper-Error [Paper-End/Paper-Fault/Paper-Out] (PE/PF/PO), when held
high, signals that a device needs servicing.  A printer pulls this
line high when it has a paper fault (no paper, a paper jam, misalign-
ment, etc.).

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]

----------------------------------------------------------------------

Status-6 (Pin 10) [Unidirectional]:

-Acknowledge clocks the transmission of data: when data has been
received, the receiver pulls this line high to acknowledge the receipt
of the data.

[This twisted-Pair's positive signal-wire connects to TTL High (+5v).]

[ACK is an INVERTED strobe on my EPSON MX-100!]=[Centronics Std.]

----------------------------------------------------------------------

Status-7 (Pin 11) [Unidirectional]:
 ____
+Busy, when held low, signals that a device cannot receive data.
After the receipt of data, a printer pulls this line low, prints the
data, then pulls this line high again.  [Twisted-Pair's -signal-wire
connects to TTL Low (Gnd).]

[BUSY is NOT INVERTED on my EPSON MX-100!]=[Centronics Std.]

----------------------------------------------------------------------











======================================================================
                               Page  5
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================
Apple Game Port (9-pin Connector)
======================================================================

This "Game Port" is strictly an "Input Port" -- It has no Outputs!

     ,---------------------.                    Coresponding Apple-II
     \  5   4   3   2   1  /                        16-Pin DIP Socket
      \   9   8   7   6   /                                (Internal)
       `-----------------                                   Pin-#'s
                                                            ========
     Pin-1  Pushbutton-1 ................................... Pin-03
     Pin-2  Power [+5VDC (TTL high)] ....................... Pin-01
     Pin-3  Ground [0VDC (TTL low)] ........................ Pin-08
  ** Pin-4  Game-Control-2 or PDL2 (Joystick-2 X-axis) ..... Pin-07
     Pin-5  Game-Control-0 or PDL0 (Joystick-1 X-axis) ..... Pin-06
  ** Pin-6  Pushbutton-2 ................................... Pin-04
     Pin-7  Pushbutton-0 (usually the "Fire" button) ....... Pin-02
     Pin-8  Game-Control-1 or PDL1 (Joystick-1 Y-axis) ..... Pin-10
  ** Pin-9  Game-Control-3 or PDL3 (Joystick-2 Y-axis) ..... Pin-11

  ** Note: These functions are not available on the IIc or IIc+.

======================================================================
Apple Game Port (Internal 16-Pin DIP Socket)
[only on the Apple-II, II+, IIe, & IIGS motherboads]
======================================================================

All Apple-II Computers with slots have this connector internally.

This "Game Port" is an "Input Port" and an "Output Port" (also known
as an "I/O Port").  It has four analog inputs, three or four digital
inputs (three on the II, II+, or IIe; & four on the IIGS), five
digital outputs [one of which is a "Strobe" output (**)], +5VDC (TTL
high) and Ground [0VDC (TTL low)], and one or two unused pins (not
connected to anything on the motherboard; two on the II, II+, or IIe;
& one on the IIGS) that can be used as junction point terminals.

Besides its usefulness as a "Game Port" [for up to four game paddles
or two joysticks (using its analog & digital inputs)], it can also be
used as an "Octal" (3-bit) or "Nibble" (4-bit) (three on the II, II+,
or IIe; & three or four on the IIGS) "Parallel Port" (using its
analog inputs for handshaking, and its digital inputs & outputs for
data and hanshaking) (***), or (theoretically:) as up to three or
four (three on the II, II+, or IIe; & four on the IIGS) "[Universal?]
Serial (1-bit) Ports" (using its digital inputs and outputs).

*** [See: Apple Disk Transfer (AP2222PC) {zip package from Asimov.net}
     <ftp://public.asimov.net/pub/apple_II/utility/ap2222pc.zip>]

======================================================================
                               Page  6
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

                        Pin# [A/D - I/O] Pin#
                       .----.-----------.----.
Pushbutton-3 (GS only) | 09 | DI+/* -0V | 08 | Ground (0VDC)
GameCtrl-1 (Stick-1 Y) | 10 | AI-   -AI | 07 | GameCtrl-2 (Stick-2 X)
GameCtrl-3 (Stick-2 Y) | 11 | AI-   -AI | 06 | GameCtrl-0 (Stick-1 X)
         Annunciator-3 | 12 | DO+   +SO | 05 | /$C040 Strobe **
         Annunciator-2 | 13 | DO+   +DI | 04 | Pushbutton-2
         Annunciator-1 | 14 | DO-   -DI | 03 | Pushbutton-1
         Annunciator-0 | 15 | DO-   -DI | 02 | Pushbutton-0
         No Connection | 16 |*NC _ +5V | 01 | +5VDC (TTL high)
                       '----'----' '----'----'
                                  ^
                           Notch on socket
          (faces toward front of computer except on the IIgs)
                   ______
** Pin-5 = /$C040 Strobe [inverse logic] output on II, II+, IIe only;
   Pin-5 = +5V pullup on GS.     [() Relative Polarities: -0v < +5v.]

----------------------------------------------------------------------
Game Port Information (with BASIC Peek/Poke locations) obtained from
the Apple-II User's Guide, Second Edition by Lon Poole, pages 430-
433; the Apple-II Reference Manual, written by Christopher Espinosa,
pages 23-25 & 100; the Apple-IIe Technical Reference Manual,  1986
Apple Computer, Inc., pages 40-43 & 189-191; the Applesoft BASIC
Programming Reference Manual,  1978 Apple Computer, Inc., pages 90
& 134-135:
----------------------------------------------------------------------

Annunciator-0   Pin-15   Off   Poke Addrs,1   49240   -16296   $C058

Turns off game control output (annunciator) number 0.  The voltage on
Pin-15 of the game control is set to approximately 0 volts (TTL low).

----------------------------------------------------------------------

Annunciator-0   Pin-15   On    Poke Addrs,1   49241   -16295   $C059

Turns on game control output (annunciator) number 0.  The voltage on
Pin-15 of the game control is set to approximately +5 volts (TTL
high).

----------------------------------------------------------------------

The following game control annunciator output (1-bit) soft switches
follow the same rules as Annunciator-0 (repeated below) for their
respective pin assignments:


======================================================================
                               Page  7
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

Annunciator-0   Pin-15   Off   Poke Addrs,1   49240   -16296   $C058
Annunciator-0   Pin-15   On    Poke Addrs,1   49241   -16295   $C059

Annunciator-1   Pin-14   Off   Poke Addrs,1   49242   -16294   $C05A
Annunciator-1   Pin-14   On    Poke Addrs,1   49243   -16293   $C05B

Annunciator-2   Pin-13   Off   Poke Addrs,1   49244   -16292   $C05C
Annunciator-2   Pin-13   On    Poke Addrs,1   49245   -16291   $C05D

Annunciator-3   Pin-12   Off   Poke Addrs,1   49246   -16290   $C05E
Annunciator-3   Pin-12   On    Poke Addrs,1   49247   -16289   $C05F

----------------------------------------------------------------------

    Read Pushbutton-0   Pin-02   Peek Addrs   49249   -16287   $C061

When the pushbutton on game control number 0 or the open-apple key is
being pressed, the value in this location exceeds 127.  When it is not
being pressed, the value is 127 or less.  [Pushbutton-0 = Open-Apple

key; Pushbutton-1 = Solid-Apple/Option key; Pushbutton-2 = Shift keys]

----------------------------------------------------------------------

The following pushbutton soft switches follow the same rules as
Pushbutton-0 (repeated below) for their respective pin assignments:

    Read Pushbutton-0   Pin-02   Peek Addrs   49249   -16287   $C061

    Read Pushbutton-1   Pin-03   Peek Addrs   49250   -16286   $C062

    Read Pushbutton-2   Pin-04   Peek Addrs   49251   -16285   $C063

GS: Read Pushbutton-3   Pin-09   Peek Addrs   49248   -16286   $C060

----------------------------------------------------------------------

The Fourth Pushbutton Switch

The Apple-II, Apple-II Plus, and Apple-IIe, each have three Pushbutton
Switch inputs through their 16-pin Game I/O sockets.  These inputs are
located at addresses 49249 through 49251 ($C061 through $C063).
Examining the schematic diagrams in the Apple-II/II+/IIe technical
reference manuals, shows there is a fourth input available.  It is
used to test the status of the audio (cassette tape) input phone jack
(labeled "CASSETTE IN") on the rear of an Apple-II/II+/IIe.  It can
also be used as a digital input.  The address of this input is even

======================================================================
                               Page  8
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

contiguous with the addresses above: 49248 ($C060).  [The logic on
this input is inverted compared to the other three, but this can be
handled in software.  (E.g., BASIC programmers can use "<128" for this
input when they use ">127" for the others, and Assembly language
programmers can use "BPL" instead of "BMI", or vice versa.)]  A
standard (mounted) phone jack with a single wire soldered to its
center conductor, with a phone cord plugged into this jack and into
the "CASSETTE IN" jack, can be used to connect to this input.  Game
port pin-9 can be used as a tie point for this connection.

The Apple-IIgs already has four Pushbutton Switch inputs through its
16-pin Game I/O socket.  It does not have audio (cassette tape) I/O
phone jacks, but its fouth switch input uses the same hardware address
and location (Game Port pin-9) as in the description above.  [And, it
uses normal/non-inverted logic (the contact is pulled up to +5vDC
intenally, on the Apple-IIgs motherboard/schematic).]

----------------------------------------------------------------------

    Stobe Output (**)   Pin-05   Peek Addrs   49216   -16320   $C040

Normally Pin-5 of the game control connector is +5 volts.  If you
PEEK memory location -16320, it drops to 0 volts for one-half
microsecond.  POKE will trigger the strobe twice.

----------------------------------------------------------------------

The following is from pages 167-168 of the Apple-IIe Reference Manual:

"The hand-control inputs are connected to the timing inputs of an
NE558 quadruple 555-type analog timer.  Addressing $C07x sends a
signal from the 74LS154 that resets all four timers and causes their
outputs to go one (high).  A variable resistance of up to 150K ohms
connected between one of these inputs and the +5V supply controls the
charging time of one of four 0.022-microfarad capacitors.  When the
voltage on the capacitor passes a certain threshhold, the output of
the NE558 changes back to zero (low)."

"Programs can determine the setting of a variable resistor by
resetting the timers and then counting time until the selected timer
input changes from high to low.  The resulting count is proportional
to the resistance."

Basically, that is a long description of the BASIC PDL() function.




======================================================================
                               Page  9
======================================================================
Apple-II 16-Pin Game-Port to IBM-PC (DB-25) Parallel/Printer-Port
======================================================================

----------------------------------------------------------------------
GameCtrl Analog Inputs Reset    Poke Addrs,1   49264   -16272   $C070
----------------------------------------------------------------------
GameCtrl-0 (Stick-1 X) Pin-06   Peek Addrs     49252   -16284   $C064
GameCtrl-1 (Stick-1 Y) Pin-10   Peek Addrs     49253   -16283   $C065
GameCtrl-2 (Stick-2 X) Pin-07   Peek Addrs     49254   -16282   $C066
GameCtrl-3 (Stick-2 Y) Pin-11   Peek Addrs     49255   -16281   $C067
----------------------------------------------------------------------

These can also be used as serial/parallel port handshaking inputs
[See: Apple Disk Transfer (AP2222PC) {zip package from Asimov.net}
<ftp://public.asimov.net/pub/apple_II/utility/ap2222pc.zip>].


======================================================================
Apple to IBM-PC - AP2222PC Disk Transfer Interface - Documentation
======================================================================

Uh-Oh, it has already been done! -- And, without any buffering and/or
line driver electronic circuitry.  See the following articles:

----------------------------------------------------------------------
From: "http://stason.org/TULARC/pc/apple2/faq/20-003-I-ve-heard-of-
       ADT-and-ap2222pc-How-do-these-packages.html"
----------------------------------------------------------------------

0. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Apple Disk Transfer (AP2222PC)\Apple Disk Transfer (AP2222PC)
      using Game Port + Parallel Interface.mht"

----------------------------------------------------------------------
From: "ftp://public.asimov.net/pub/apple_II/utility/ap2222pc.zip"
----------------------------------------------------------------------

1. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Disk Images\Apple Disk Transfer (AP2222PC)\README.1ST"
2. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Disk Images\Apple Disk Transfer (AP2222PC)\QUICKIN.DOC"
3. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Disk Images\Apple Disk Transfer (AP2222PC)\LINECONN.DOC"
4. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Disk Images\Apple Disk Transfer (AP2222PC)\AP2222PC.DOC"
5. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Disk Images\Apple Disk Transfer (AP2222PC)\AP2222PC.SEQ"
6. "C:\Users\Public\Documents\Apple Computer\Apple-II Docs
      \Disk Images\Apple Disk Transfer (AP2222PC)\LOADER.ASM"


======================================================================
                               Page 10
